<html>
<head><meta charset="utf-8"><title>log crate levels · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html">log crate levels</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="185394742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185394742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185394742">(Jan 11 2020 at 15:51)</a>:</h4>
<p>Is there a resource somewhere explaining how to meaningfully use the log crate levels ?</p>



<a name="185394748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185394748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185394748">(Jan 11 2020 at 15:51)</a>:</h4>
<p>Or some kind of guidelines ?</p>



<a name="185394802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185394802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185394802">(Jan 11 2020 at 15:52)</a>:</h4>
<p>When debugging large applications with many crates it is kind of apparent that some crates use <code>debug!</code> for what should probably be <code>info!</code>, others use <code>debug!</code> for what should probably be <code>trace!</code>, and the best solution is to just output <code>trace!</code>s and above and hope for the best.</p>



<a name="185394813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185394813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185394813">(Jan 11 2020 at 15:53)</a>:</h4>
<p>In particular, there does not seem to be a distinction between "debug log for somebody working on improving the current crate" and "debug log for somebody using this crate somewhere"</p>



<a name="185394818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185394818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185394818">(Jan 11 2020 at 15:53)</a>:</h4>
<p>Unless that's what the distinction between <code>debug!</code> and <code>trace!</code> is, but the docs don't really say anything about how the different levels should be used.</p>



<a name="185394931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185394931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185394931">(Jan 11 2020 at 15:56)</a>:</h4>
<p>I personally have always considered the levels to essentially correspond to <code>-v</code> levels on the command line, so, essentially app-specific and largely not "meaningful"</p>



<a name="185394936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185394936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185394936">(Jan 11 2020 at 15:56)</a>:</h4>
<p>i.e., there's not any particular notion of "this is what goes in which"</p>



<a name="185395214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185395214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185395214">(Jan 11 2020 at 16:04)</a>:</h4>
<p>Using names like debug, error, warn, info and trace does suggest a meaning</p>



<a name="185395236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185395236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185395236">(Jan 11 2020 at 16:05)</a>:</h4>
<p>but I personally just always log everything, and try to filter it afterwards</p>



<a name="185395237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185395237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185395237">(Jan 11 2020 at 16:05)</a>:</h4>
<p>because of the problems above</p>



<a name="185395251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185395251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185395251">(Jan 11 2020 at 16:05)</a>:</h4>
<p>I think the distinction between "relevant for people developing this crate" and "relevant for people using this create" is useful</p>



<a name="185395305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185395305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185395305">(Jan 11 2020 at 16:06)</a>:</h4>
<p>When using <code>hyper</code> I get a lot of logs about 7 bytes read here, written there, etc. when I usually only care about which http requests were performed</p>



<a name="185395910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185395910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185395910">(Jan 11 2020 at 16:25)</a>:</h4>
<p>Yes, I think there is potential for meaningful assignment -- but I'm saying that that assignment is library-specific</p>



<a name="185395912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185395912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185395912">(Jan 11 2020 at 16:26)</a>:</h4>
<p>(at least currently)</p>



<a name="185395965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185395965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185395965">(Jan 11 2020 at 16:27)</a>:</h4>
<p>Ah I fully agree, that's the issue I'm trying to raise</p>



<a name="185396014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185396014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185396014">(Jan 11 2020 at 16:28)</a>:</h4>
<p>I'm not sure if I agree that I'd want to change that either :)</p>
<p>Or at least it seems like we'd rather want an orthogonal flag</p>



<a name="185396021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185396021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185396021">(Jan 11 2020 at 16:29)</a>:</h4>
<p>i.e., for developer/for end user of library is orthogonal to the logging level, it feels like</p>



<a name="185397119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185397119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185397119">(Jan 11 2020 at 17:01)</a>:</h4>
<p>maybe</p>



<a name="185397124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/log%20crate%20levels/near/185397124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/log.20crate.20levels.html#185397124">(Jan 11 2020 at 17:01)</a>:</h4>
<p>that makes sense to me</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>